# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=cargo-c
pkgver=0.6.10
pkgrel=0
pkgdesc="A cargo subcommand to build and install C-ABI compatibile dynamic and static libraries"
url="https://github.com/lu-zero/cargo-c"
arch="all !s390x !mips !mips64" # no cargo for these archies
license="MIT"
makedepends="cargo openssl-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/lu-zero/cargo-c/archive/v$pkgver.tar.gz
	$pkgname-$pkgver-Cargo.lock::https://github.com/lu-zero/cargo-c/releases/download/v$pkgver/Cargo.lock"

prepare() {
	default_prepare

	cp "$srcdir"/$pkgname-$pkgver-Cargo.lock Cargo.lock
	cargo fetch --locked
}

build() {
	cargo build --release --frozen
}

check() {
	cargo test --release --frozen
}

package() {
	cargo install --locked --root "$pkgdir/usr" --path .

	install -Dm 644 -t "$pkgdir/usr/share/doc/cargo-c" README.md

	rm "$pkgdir"/usr/.crates.toml
	rm "$pkgdir"/usr/.crates2.json
}

sha512sums="9964f72571c98d14b77558757b32eac17fecb75d3797af8ea9e137002371c1e5be7ffefec9a90e01d9b43706b161412d1d6dac125d07d28913723237f0bef29b  cargo-c-0.6.10.tar.gz
d2783450327e580b1b4f6cd3cdbd823c03abeae96526bf7f83b08155f17780a169a90987c4dc0303ef9a4eff02d6da375177f531892d139d964249cce6f462ad  cargo-c-0.6.10-Cargo.lock"
